package com.alibaba.citrus.cr.mn.order.center.forecastorder.ability;

import com.alibaba.citrus.cr.common.annotation.FacadeInvoker;
import com.alibaba.citrus.cr.common.enums.GeneralStatusEnum;
import com.alibaba.citrus.cr.common.enums.ordercenter.*;
import com.alibaba.citrus.cr.common.exception.FunctionException;
import com.alibaba.citrus.cr.mn.order.center.common.enums.ForecastStatusEnum;
import com.alibaba.citrus.cr.mn.order.center.common.util.AssertUtils;
import com.alibaba.citrus.cr.mn.order.center.facade.adapter.BaseDataServiceAdapter;
import com.alibaba.citrus.cr.mn.order.center.facade.adapter.DictionaryVerifyAdapter;
import com.alibaba.cz.base.tool.log.Log;
import com.epoch.app.mnordercenter.contants.MnOrderCenterConstants;
import com.epoch.app.mnordercenter.model.dto.DictionaryResponse;
import com.epoch.app.mnordercenter.model.dto.PageQueryForecastLineRequest;
import com.epoch.app.mnordercenter.model.dto.PageQueryForecastRequest;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.Function;
import java.util.stream.Collectors;

@Service("forecastOrderGroupAbility")
public class ForecastOrderGroupAbility {
    private static final Log log = Log.getLogger(ForecastOrderGroupAbility.class);

    @Resource
    private DictionaryVerifyAdapter dictionaryVerifyAdapter;
    @Resource
    private BaseDataServiceAdapter baseDataServiceAdapter;
    private static ForecastOrderGroupAbility forecastOrderAbility;

    @PostConstruct
    public void init() {
        forecastOrderAbility = this;
        forecastOrderAbility.dictionaryVerifyAdapter = dictionaryVerifyAdapter;
    }

    public static void pageQueryLineRequestCheck(PageQueryForecastLineRequest request, String orderCategory) {
        if (Objects.isNull(request.getPage())) {
            request.setPage(1);
        }
        if (Objects.isNull(request.getSize())) {
            request.setSize(10);
        }
        AssertUtils.isTrue(StringUtils.isBlank(request.getBusinessType()), "OC-01-001-01-15-001", "业态编码");
        AssertUtils.lengthCheck(request.getBusinessType(), 10, true, "OC-01-001-01-15-004", "业态编码");
        AssertUtils.isTrue(request.getPage() > MnOrderCenterConstants.MAX_PAGE().intValue(), "OC-01-001-01-15-009", "页数", "最大值为" + MnOrderCenterConstants.MAX_PAGE().intValue());
        AssertUtils.isTrue(request.getSize() > MnOrderCenterConstants.MAX_SIZE().intValue(), "OC-01-001-01-15-009", "分页条数", "最大值为" + MnOrderCenterConstants.MAX_SIZE().intValue());
        AssertUtils.isTrue(request.getPage() <= 0, "OC-01-001-01-15-009", "页数", "最小值为1");
        AssertUtils.isTrue(request.getSize() <= 0, "OC-01-001-01-15-009", "分页条数", "最小值为1");
        forecastOrderAbility.dictionaryVerifyAdapter.verifyDictionary(DictionaryTypeEnum.BUSINESS_TYPE.getCode(), request.getBusinessType(), new FunctionException("OC-01-001-01-15-006", "业态编码"));
        if (CollectionUtils.isNotEmpty(request.getFromSysList())) {
            AssertUtils.isTrue(request.getFromSysList().size() > 10, "OC-01-001-01-15-004", "来源系统编码集合", request.getFromSysList().size(), 10);
            request.getFromSysList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "来源系统编码");
                forecastOrderAbility.dictionaryVerifyAdapter.verifyDictionary(DictionaryTypeEnum.FROM_SYS.getCode(), x, new FunctionException("OC-01-001-01-15-006", "来源系统编码"));
            });
        }
        if (CollectionUtils.isNotEmpty(request.getBusinessUnitCodeList())) {
            AssertUtils.isTrue(request.getBusinessUnitCodeList().size() > 10, "OC-01-001-01-15-004", "业务单元编码集合", request.getBusinessUnitCodeList().size(), 10);
            request.getBusinessUnitCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "业务单元编码"));
            request.getBusinessUnitCodeList().forEach(businessUnitCode -> {
                forecastOrderAbility.dictionaryVerifyAdapter.verifyDictionary(DictionaryTypeEnum.BUSINESS_UNIT_CODE.getCode(), businessUnitCode, new FunctionException("OC-01-001-01-15-006", "业务单元编码"));
            });
        }
        if (CollectionUtils.isNotEmpty(request.getOrderChannelCodeList())) {
            AssertUtils.isTrue(request.getOrderChannelCodeList().size() > 5, "OC-01-001-01-15-004", "订单渠道编码集合", request.getOrderChannelCodeList().size(), 5);
            request.getOrderChannelCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "订单渠道编码"));
        }
        if (CollectionUtils.isNotEmpty(request.getSalesOrderNoList())) {
            AssertUtils.isTrue(request.getSalesOrderNoList().size() > 10, "OC-01-001-01-15-004", "预报订单单号集合", request.getSalesOrderNoList().size(), 10);
            request.getSalesOrderNoList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "预报订单单号"));
        }
        if (CollectionUtils.isNotEmpty(request.getSourceOrderNoList())) {
            AssertUtils.isTrue(request.getSourceOrderNoList().size() > 50, "OC-01-001-01-15-004", "来源单号集合", request.getSourceOrderNoList().size(), 50);
            request.getSourceOrderNoList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "来源单号"));
        }
        if (CollectionUtils.isNotEmpty(request.getOutOrderNoList())) {
            AssertUtils.isTrue(request.getOutOrderNoList().size() > 20, "OC-01-001-01-15-004", "外部单号集合", request.getOutOrderNoList().size(), 20);
            request.getOutOrderNoList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "外部单号"));
        }
        AssertUtils.lengthCheck(request.getProductGroupCode(), 50, false, "OC-01-001-01-15-004", "产品组编码");
        AssertUtils.lengthCheck(request.getBusinessChannel(), 50, false, "OC-01-001-01-15-004", "业务渠道编码");
        AssertUtils.lengthCheck(request.getSalesOrganizationCode(), 50, false, "OC-01-001-01-15-004", "销售组织编码");
        if (CollectionUtils.isNotEmpty(request.getCustomerCodeList())) {
            AssertUtils.isTrue(request.getCustomerCodeList().size() > 10, "OC-01-001-01-15-004", "客户售达方编码集合", request.getCustomerCodeList().size(), 10);
            request.getCustomerCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "客户售达方编码"));
        }
        if (CollectionUtils.isNotEmpty(request.getShipToPartyCodeList())) {
            AssertUtils.isTrue(request.getShipToPartyCodeList().size() > 10, "OC-01-001-01-15-004", "客户送达方编码集合", request.getShipToPartyCodeList().size(), 10);
            request.getShipToPartyCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "客户送达方编码"));
        }
        if (CollectionUtils.isNotEmpty(request.getSalesDepartmentCodeList())) {
            AssertUtils.isTrue(request.getSalesDepartmentCodeList().size() > 10, "OC-01-001-01-15-004", "销售部门编码集合", request.getSalesDepartmentCodeList().size(), 10);
            request.getSalesDepartmentCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "销售部门编码"));
        }
        if (CollectionUtils.isNotEmpty(request.getSalesChannelCodeList())) {
            AssertUtils.isTrue(request.getSalesChannelCodeList().size() > 10, "OC-01-001-01-15-004", "销售渠道编码集合", request.getSalesChannelCodeList().size(), 10);
            request.getSalesChannelCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "销售渠道编码"));
        }
        if (CollectionUtils.isNotEmpty(request.getKaSystemList())) {
            AssertUtils.isTrue(request.getKaSystemList().size() > 10, "OC-01-001-01-15-004", "KA系统集合", request.getKaSystemList().size(), 10);
            request.getKaSystemList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "KA系统");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getKaAreaList())) {
            AssertUtils.isTrue(request.getKaAreaList().size() > 10, "OC-01-001-01-15-004", "KA大区集合", request.getKaAreaList().size(), 10);
            request.getKaAreaList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "KA大区");
            });
        }
        AssertUtils.lengthCheck(request.getCustomerGrade(), 50, false, "OC-01-001-01-15-004", "客户等级");
        AssertUtils.lengthCheck(request.getCustomerGroup(), 50, false, "OC-01-001-01-15-004", "客户组");
        if (CollectionUtils.isNotEmpty(request.getOrderTypeCodeList())) {
            AssertUtils.isTrue(request.getOrderTypeCodeList().size() > 10, "OC-01-001-01-15-004", "订单类型编码集合", request.getOrderTypeCodeList().size(), 10);
            request.getOrderTypeCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "订单类型编码"));
            if(OrderCategoryEnum.GROUP.getCode().equals(orderCategory)) {
                List<String> checkExistList = request.getOrderTypeCodeList().stream().filter(x ->
                        !Lists.newArrayList(ForecastOrderTypeEnum.GROUP_FORECAST.getCode()).contains(x)).collect(Collectors.toList());
                AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "订单类型编码集合");
            }else if(OrderCategoryEnum.COMPANY.getCode().equals(orderCategory)){
                List<String> checkExistList = request.getOrderTypeCodeList().stream().filter(x ->
                        !Lists.newArrayList(ForecastOrderTypeEnum.STD_FORECAST.getCode(),ForecastOrderTypeEnum.REPLENISH_FORECAST.getCode()).contains(x)).collect(Collectors.toList());
                AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "订单类型编码集合");
            }
        }
        if (CollectionUtils.isNotEmpty(request.getDeliveryMethodCodeList())) {
            AssertUtils.isTrue(request.getDeliveryMethodCodeList().size() > 10, "OC-01-001-01-15-004", "配送方式编码集合", request.getDeliveryMethodCodeList().size(), 10);
            request.getDeliveryMethodCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "配送方式编码"));
            List<String> checkExistList = request.getDeliveryMethodCodeList().stream().filter(x -> !SalesOrderDeliveryMethodEnum.codes().contains(x)).collect(Collectors.toList());
            AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "配送方式编码集合");
        }
        if (StringUtils.isNotBlank(request.getIsClose())) {
            AssertUtils.lengthCheck(request.getIsClose(), 50, false, "OC-01-001-01-15-004", "是否关闭");
            AssertUtils.isTrue(!Lists.newArrayList(GeneralStatusEnum.YES.getCode().toString(), GeneralStatusEnum.NO.getCode().toString()).contains(request.getIsClose()), "OC-01-001-01-15-006", "是否关闭");
        }
        AssertUtils.lengthCheck(request.getDeliveryMethodCode(), 50, false, "OC-01-001-01-15-004", "配送方式编码");
        if (StringUtils.isNotBlank(request.getFulfillmentTypeCode())) {
            AssertUtils.isTrue(request.getFulfillmentTypeCode().length() > 50, "OC-01-001-01-15-004", "履约方式编码", request.getFulfillmentTypeCode().length(), "50");
            if(OrderCategoryEnum.GROUP.getCode().equals(orderCategory)) {
                List<DictionaryResponse> fulfillmentTypeList = forecastOrderAbility.baseDataServiceAdapter.queryDictionarys(DictionaryTypeEnum.GROUP_SALE_FULFILLMENT_TYPE.getCode());
                Map<String, DictionaryResponse> fulfillmentTypeMap = fulfillmentTypeList.stream().collect(Collectors.toMap(DictionaryResponse::getCode, Function.identity(), (k1, k2) -> k2));
                DictionaryResponse dictionaryResponse = fulfillmentTypeMap.get(request.getFulfillmentTypeCode());
                AssertUtils.isTrue(dictionaryResponse == null, "OC-01-001-01-15-006", "履约方式编码");
            } else if(OrderCategoryEnum.COMPANY.getCode().equals(orderCategory)){
                //履约方式
                List<DictionaryResponse> fulfillmentTypeList = forecastOrderAbility.baseDataServiceAdapter.queryDictionarys(DictionaryTypeEnum.COMPANY_SALE_FULFILLMENT_TYPE.getCode());
                Map<String, DictionaryResponse> fulfillmentTypeMap = fulfillmentTypeList.stream().collect(Collectors.toMap(DictionaryResponse::getCode, Function.identity(), (k1, k2) -> k2));
                DictionaryResponse dictionaryResponse = fulfillmentTypeMap.get(request.getFulfillmentTypeCode());
                AssertUtils.isTrue(dictionaryResponse == null, "OC-01-001-01-15-006", "履约方式编码");
            }
        }
        if (StringUtils.isNotBlank(request.getFulfillmentPriority())) {
            AssertUtils.isTrue(request.getFulfillmentPriority().length() > 50, "OC-01-001-01-15-004", "履约优先级", request.getFulfillmentPriority().length(), "50");
            FulfillmentPriorityEnum fulfillmentPriorityEnum = FulfillmentPriorityEnum.of(request.getFulfillmentPriority());
            AssertUtils.isTrue(fulfillmentPriorityEnum == null, "OC-01-001-01-15-006", "履约优先级");
        }
        AssertUtils.lengthCheck(request.getAutoFulfillment(), 50, false, "OC-01-001-01-15-004", "是否手动创建履约单");
        if (StringUtils.isNotEmpty(request.getOrderBizTag())) {
            AssertUtils.isTrue(request.getOrderBizTag().length() > 50, "OC-01-001-01-15-004", "订单标签", request.getOrderBizTag().length(), "50");
            AssertUtils.isTrue(!OrderBizTagEnum.codes().contains(request.getOrderBizTag()), "OC-01-001-01-15-006", "订单标签");
        }
        if (CollectionUtils.isNotEmpty(request.getStatusList())) {
            AssertUtils.isTrue(request.getStatusList().size() > 5, "OC-01-001-01-15-004", "主单状态集合", request.getStatusList().size(), 5);
            request.getStatusList().forEach(x -> AssertUtils.lengthCheck(x, 10, false, "OC-01-001-01-15-004", "主单状态"));
            List<String> statusList = ForecastStatusEnum.codes().stream().map(String::valueOf).collect(Collectors.toList());
            List<String> checkExistList = request.getStatusList().stream().filter(x -> !statusList.contains(x)).collect(Collectors.toList());
            AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "主单状态集合");
        }
        if (CollectionUtils.isNotEmpty(request.getDetailStatusList())) {
            AssertUtils.isTrue(request.getDetailStatusList().size() > 10, "OC-01-001-01-15-004", "明细状态集合", request.getDetailStatusList().size(), 10);
            request.getDetailStatusList().forEach(x -> AssertUtils.lengthCheck(x, 10, false, "OC-01-001-01-15-004", "明细状态"));
            List<String> statusList = ForecastStatusEnum.codes().stream().map(String::valueOf).collect(Collectors.toList());
            List<String> checkExistList = request.getDetailStatusList().stream().filter(x -> !statusList.contains(x)).collect(Collectors.toList());
            AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "明细状态集合");
        }
        if (CollectionUtils.isNotEmpty(request.getOrderReasonCodeList())) {
            AssertUtils.isTrue(request.getOrderReasonCodeList().size() > 10, "OC-01-001-01-15-004", "订单原因编码集合", request.getOrderReasonCodeList().size(), 10);
            request.getOrderReasonCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "订单原因编码"));
            List<String> checkExistList = request.getOrderReasonCodeList().stream().filter(x -> !SalesOrderReasonEnum.codes().contains(x)).collect(Collectors.toList());
            AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "订单原因编码集合");
        }
        AssertUtils.lengthCheck(request.getNote(), 255, false, "OC-01-001-01-15-004", "备注（主单）");
        AssertUtils.lengthCheck(request.getDetailNote(), 255, false, "OC-01-001-01-15-004", "明细备注");
        AssertUtils.lengthCheck(request.getCreatorCode(), 50, false, "OC-01-001-01-15-004", "创建人工号");
        AssertUtils.lengthCheck(request.getModifierCode(), 50, false, "OC-01-001-01-15-004", "修改人工号");
        if (CollectionUtils.isNotEmpty(request.getCustomerPurchaseOrderNoList())) {
            AssertUtils.isTrue(request.getCustomerPurchaseOrderNoList().size() > 10, "OC-01-001-01-15-004", "客户采购订单号集合", request.getCustomerPurchaseOrderNoList().size(), 10);
            request.getCustomerPurchaseOrderNoList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "客户采购订单号"));
        }
        AssertUtils.lengthCheck(request.getContact(), 50, false, "OC-01-001-01-15-004", "联系人");
        AssertUtils.lengthCheck(request.getContactPhone(), 11, false, "OC-01-001-01-15-004", "联系电话");
        if (CollectionUtils.isNotEmpty(request.getReceiveWarehouseCodeList())) {
            AssertUtils.isTrue(request.getReceiveWarehouseCodeList().size() > 10, "OC-01-001-01-15-004", "收货仓（逻辑仓库编码）集合", request.getReceiveWarehouseCodeList().size(), 10);
            request.getReceiveWarehouseCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "收货仓（逻辑仓库编码）"));
        }
        if (CollectionUtils.isNotEmpty(request.getProductCodeList())) {
            AssertUtils.isTrue(request.getProductCodeList().size() > 10, "OC-01-001-01-15-004", "物料编码集合", request.getProductCodeList().size(), 10);
            request.getProductCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "物料编码"));
        }
        if (CollectionUtils.isNotEmpty(request.getShippingWarehouseCodeList())) {
            AssertUtils.isTrue(request.getShippingWarehouseCodeList().size() > 10, "OC-01-001-01-15-004", "发货仓编码（逻辑仓）集合", request.getShippingWarehouseCodeList().size(), 10);
            request.getShippingWarehouseCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "发货仓编码（逻辑仓）"));
        }
        AssertUtils.lengthCheck(request.getDeliveryFactoryCode(), 50, false, "OC-01-001-01-15-004", "发货工厂编码");
        AssertUtils.lengthCheck(request.getStockCode(), 50, false, "OC-01-001-01-15-004", "库存地点编码");
        if (CollectionUtils.isNotEmpty(request.getCloseReasonCodeList())) {
            AssertUtils.isTrue(request.getCloseReasonCodeList().size() > 10, "OC-01-001-01-15-004", "关闭原因编码集合", request.getCloseReasonCodeList().size(), 10);
            request.getCloseReasonCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "关闭原因编码"));
            List<String> checkExistList = request.getCloseReasonCodeList().stream().filter(x -> !SalesOrderCloseEnum.codes().contains(x)).collect(Collectors.toList());
            AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "关闭原因编码集合");
        }
        AssertUtils.lengthCheck(request.getDetailNote(), 255, false, "OC-01-001-01-15-004", "订单行备注");
        AssertUtils.lengthCheck(request.getValidBeginDateStart(), 10, false, "OC-01-001-01-15-004", "生效日期（开始日期）");
        AssertUtils.lengthCheck(request.getValidBeginDateEnd(), 10, false, "OC-01-001-01-15-004", "生效日期（结束日期）");
        Map<String, String> vaildBeginTimeMap = AssertUtils.timeFormatCheck(request.getValidBeginDateStart(), request.getValidBeginDateEnd(), "生效日期（开始日期）", "生效日期（结束日期）", AssertUtils.TYPE_DATE);
        AssertUtils.lengthCheck(request.getExpectDeliveryBeginDate(), 10, false, "OC-01-001-01-15-004", "期望交货日期（开始日期）");
        AssertUtils.lengthCheck(request.getExpectDeliveryEndDate(), 10, false, "OC-01-001-01-15-004", "期望交货日期（结束日期）");
        Map<String, String> expectedDeliveryTimeMap = AssertUtils.timeFormatCheck(request.getExpectDeliveryBeginDate(), request.getExpectDeliveryEndDate(), "期望交货日期（开始日期）", "期望交货日期（结束日期）", AssertUtils.TYPE_DATE);
        AssertUtils.lengthCheck(request.getCreateBeginTime(), 19, false, "OC-01-001-01-15-004", "创建时间（开始时间）");
        AssertUtils.lengthCheck(request.getCreateEndTime(), 19, false, "OC-01-001-01-15-004", "创建时间（结束时间）");
        Map<String, String> createTimeMap = AssertUtils.timeFormatCheck(request.getCreateBeginTime(), request.getCreateEndTime(), "创建时间（开始时间）", "创建时间（结束时间）", AssertUtils.TYPE_TIME);
        AssertUtils.lengthCheck(request.getModifyBeginTime(), 19, false, "OC-01-001-01-15-004", "修改时间（开始时间）");
        AssertUtils.lengthCheck(request.getModifyEndTime(), 19, false, "OC-01-001-01-15-004", "修改时间（结束时间）");
        Map<String, String> updateTimeMap = AssertUtils.timeFormatCheck(request.getModifyBeginTime(), request.getModifyEndTime(), "修改时间（开始时间）", "修改时间（结束时间）", AssertUtils.TYPE_TIME);
        AssertUtils.lengthCheck(request.getSourceOrderBeginTime(), 19, false, "OC-01-001-01-15-004", "来单时间（开始时间）");
        AssertUtils.lengthCheck(request.getSourceOrderEndTime(), 19, false, "OC-01-001-01-15-004", "来单时间（结束时间）");
        Map<String, String> sourceTimeMap = AssertUtils.timeFormatCheck(request.getSourceOrderBeginTime(), request.getSourceOrderEndTime(), "来单时间（开始时间）", "来单时间（结束时间）", AssertUtils.TYPE_TIME);
        Map<String, String> deadlineDate = AssertUtils.timeFormatCheck(request.getDeadlineStartDate(), request.getDeadlineEndDate(), "截止日期（开始日期）", "截止日期（结束日期）", AssertUtils.TYPE_DATE);
        request.setValidBeginDateStart(vaildBeginTimeMap.get(AssertUtils.START_TIME));
        request.setValidBeginDateEnd(vaildBeginTimeMap.get(AssertUtils.END_TIME));
        request.setExpectDeliveryBeginDate(expectedDeliveryTimeMap.get(AssertUtils.START_TIME));
        request.setExpectDeliveryEndDate(expectedDeliveryTimeMap.get(AssertUtils.END_TIME));
        request.setCreateBeginTime(createTimeMap.get(AssertUtils.START_TIME));
        request.setCreateEndTime(createTimeMap.get(AssertUtils.END_TIME));
        request.setModifyBeginTime(updateTimeMap.get(AssertUtils.START_TIME));
        request.setModifyEndTime(updateTimeMap.get(AssertUtils.END_TIME));
        request.setSourceOrderBeginTime(sourceTimeMap.get(AssertUtils.START_TIME));
        request.setSourceOrderEndTime(sourceTimeMap.get(AssertUtils.END_TIME));
        request.setDeadlineStartDate(deadlineDate.get(AssertUtils.START_TIME));
        request.setDeadlineEndDate(deadlineDate.get(AssertUtils.END_TIME));
        if (CollectionUtils.isNotEmpty(request.getAnalysisReasonList())) {
            AssertUtils.isTrue(request.getAnalysisReasonList().size() > 1024, "OC-01-001-01-15-004", "分析原因集合", request.getAnalysisReasonList().size(), 1024);
            request.getAnalysisReasonList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "分析原因"));
        }
        if (CollectionUtils.isNotEmpty(request.getAnalysisStatusList())) {
            AssertUtils.isTrue(request.getAnalysisStatusList().size() > 10, "OC-01-001-01-15-004", "分析状态集合", request.getAnalysisStatusList().size(), 10);
            request.getAnalysisStatusList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "分析状态");
                AssertUtils.isWholeNumber(x, false, "OC-01-001-01-15-009", "分析状态","分析状态须为正整数");
                AssertUtils.isTrue(new BigDecimal("2147483647").compareTo(new BigDecimal(x)) < 0, "OC-01-001-01-15-009", "分析状态", "最大2147483647");

            });
        }
        if(CollectionUtils.isNotEmpty(request.getStatusList())){
            List<String> checkExistList = request.getStatusList().stream().filter(x -> {
                if(ForecastStatusEnum.of(Integer.valueOf(x)) == null) {
                    return true;
                }else{
                    return false;
                }
            }).collect(Collectors.toList());
            AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "订单状态集合");
        }
    }

    @FacadeInvoker
    public static void pageQueryRequestCheck(PageQueryForecastRequest request, String orderCategory) {
        if (request.getPage() == null) {
            request.setPage(1);
        }
        if (request.getSize() == null) {
            request.setSize(10);
        }
        // 必填校验
        AssertUtils.isTrue(StringUtils.isBlank(request.getBusinessType()), "OC-01-001-01-15-001", "业态编码");
        AssertUtils.lengthCheck(request.getBusinessType(), 10, true, "OC-01-001-01-15-004", "业态编码");
        AssertUtils.isTrue(request.getPage() > MnOrderCenterConstants.MAX_PAGE().intValue(), "OC-01-001-01-15-009", "页数", "最大值为" + MnOrderCenterConstants.MAX_PAGE().intValue());
        AssertUtils.isTrue(request.getSize() > MnOrderCenterConstants.MAX_SIZE().intValue(), "OC-01-001-01-15-009", "分页条数", "最大值为" + MnOrderCenterConstants.MAX_SIZE().intValue());
        AssertUtils.isTrue(request.getPage() <= 0, "OC-01-001-01-15-009", "页数", "最小值为1");
        AssertUtils.isTrue(request.getSize() <= 0, "OC-01-001-01-15-009", "分页条数", "最小值为1");

        // 合法性校验
        if (CollectionUtils.isNotEmpty(request.getFromSysList())) {
            AssertUtils.isTrue(request.getFromSysList().size() > 10, "OC-01-001-01-15-004", "来源系统编码集合", request.getFromSysList().size(), 10);
            request.getFromSysList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "来源系统编码");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getBusinessUnitCodeList())) {
            AssertUtils.isTrue(request.getBusinessUnitCodeList().size() > 10, "OC-01-001-01-15-004", "业务单元编码集合", request.getBusinessUnitCodeList().size(), 10);
            request.getBusinessUnitCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "业务单元编码");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getSalesOrderNoList())) {
            AssertUtils.isTrue(request.getSalesOrderNoList().size() > 10, "OC-01-001-01-15-004", "预报订单单号集合", request.getSalesOrderNoList().size(), 10);
            request.getSalesOrderNoList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "预报订单单号");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getSourceOrderNoList())) {
            AssertUtils.isTrue(request.getSourceOrderNoList().size() > 10, "OC-01-001-01-15-004", "来源单号集合", request.getSourceOrderNoList().size(), 10);
            request.getSourceOrderNoList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "来源单号");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getOrderTypeCodeList())) {
            AssertUtils.isTrue(request.getOrderTypeCodeList().size() > 10, "OC-01-001-01-15-004", "订单类型编码集合", request.getOrderTypeCodeList().size(), 10);
            request.getOrderTypeCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "订单类型编码");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getShippingWarehouseCodeList())) {
            AssertUtils.isTrue(request.getShippingWarehouseCodeList().size() > 10, "OC-01-001-01-15-004", "逻辑仓库编码集合", request.getShippingWarehouseCodeList().size(), 10);
            request.getShippingWarehouseCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "逻辑仓库编码");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getOrderChannelCodeList())) {
            AssertUtils.isTrue(request.getOrderChannelCodeList().size() > 5, "OC-01-001-01-15-004", "订单渠道编码集合", request.getOrderChannelCodeList().size(), 5);
            request.getOrderChannelCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "订单渠道编码");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getOuterOrderNoList())) {
            AssertUtils.isTrue(request.getOuterOrderNoList().size() > 20, "OC-01-001-01-15-004", "外部单号集合", request.getOuterOrderNoList().size(), 20);
            request.getOuterOrderNoList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "外部单号");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getSalesChannelCodeList())) {
            AssertUtils.isTrue(request.getSalesChannelCodeList().size() > 10, "OC-01-001-01-15-004", "销售渠道编码集合", request.getSalesChannelCodeList().size(), 10);
            request.getSalesChannelCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "销售渠道编码");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getSalesDepartmentCodeList())) {
            AssertUtils.isTrue(request.getSalesDepartmentCodeList().size() > 10, "OC-01-001-01-15-004", "销售部门编码集合", request.getSalesDepartmentCodeList().size(), 10);
            request.getSalesDepartmentCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "销售部门编码");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getKaSystemList())) {
            AssertUtils.isTrue(request.getKaSystemList().size() > 10, "OC-01-001-01-15-004", "KA系统集合", request.getKaSystemList().size(), 10);
            request.getKaSystemList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "KA系统");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getKaAreaList())) {
            AssertUtils.isTrue(request.getKaAreaList().size() > 10, "OC-01-001-01-15-004", "KA大区集合", request.getKaAreaList().size(), 10);
            request.getKaAreaList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "KA大区");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getOrderStatusList())) {
            AssertUtils.isTrue(request.getOrderStatusList().size() > 5, "OC-01-001-01-15-004", "订单状态集合", request.getOrderStatusList().size(), 5);
            request.getOrderStatusList().forEach(x -> {
                AssertUtils.lengthCheck(x, 10, false, "OC-01-001-01-15-004", "订单状态");
                AssertUtils.isWholeNumber(x, false, "OC-01-001-01-15-009", "订单状态", "订单状态须为正整数");
                ForecastStatusEnum forecastStatusEnum = ForecastStatusEnum.of(Integer.valueOf(x));
                Optional.ofNullable(forecastStatusEnum).orElseThrow(() -> new FunctionException("OC-01-001-01-15-006", "订单状态"));
            });
        }
        if (CollectionUtils.isNotEmpty(request.getOrderReasonCodeList())) {
            AssertUtils.isTrue(request.getOrderReasonCodeList().size() > 10, "OC-01-001-01-15-004", "订单原因编码集合", request.getOrderReasonCodeList().size(), 10);
            request.getOrderReasonCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x.toString(), 50, false, "OC-01-001-01-15-004", "订单原因编码");
                SalesOrderReasonEnum salesOrderReasonEnum = SalesOrderReasonEnum.of(x);
                Optional.ofNullable(salesOrderReasonEnum).orElseThrow(() -> new FunctionException("OC-01-001-01-15-006", "订单原因编码"));
            });
        }
        if (CollectionUtils.isNotEmpty(request.getCloseCodeList())) {
            AssertUtils.isTrue(request.getCloseCodeList().size() > 100, "OC-01-001-01-15-004", "关闭原因编码列表", request.getCloseCodeList().size(), 100);
            request.getCloseCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x.toString(), 50, false, "OC-01-001-01-15-004", "关闭原因编码");
                SalesOrderCloseEnum closeEnum = SalesOrderCloseEnum.of(x);
                Optional.ofNullable(closeEnum).orElseThrow(() -> new FunctionException("OC-01-001-01-15-006", "关闭原因编码"));
            });
        }
        AssertUtils.lengthCheck(request.getSalesOrderNo(), 50, false, "OC-01-001-01-15-004", "预报订单号");
        AssertUtils.lengthCheck(request.getDeliveryFactoryCode(), 50, false, "OC-01-001-01-15-004", "交货工厂编码");
        AssertUtils.lengthCheck(request.getStockCode(), 50, false, "OC-01-001-01-15-004", "库存地点编码");
        AssertUtils.lengthCheck(request.getCustomerCode(), 50, false, "OC-01-001-01-15-004", "客户售达方编码");
        AssertUtils.lengthCheck(request.getShipToPartyCode(), 50, false, "OC-01-001-01-15-004", "客户送达方编码");
        AssertUtils.lengthCheck(request.getSalesOrganizationCode(), 50, false, "OC-01-001-01-15-004", "销售组织编码");
        AssertUtils.lengthCheck(request.getSalesDepartmentCode(), 50, false, "OC-01-001-01-15-004", "销售部门编码");
        AssertUtils.lengthCheck(request.getNote(), 255, false, "OC-01-001-01-15-004", "备注（主单）");
        AssertUtils.lengthCheck(request.getCreatorCode(), 50, false, "OC-01-001-01-15-004", "创建人工号");
        AssertUtils.lengthCheck(request.getModifierCode(), 50, false, "OC-01-001-01-15-004", "修改人工号");
        AssertUtils.lengthCheck(request.getCustomerPurchaseOrderNo(), 50, false, "OC-01-001-01-15-004", "客户采购订单号");
        AssertUtils.lengthCheck(request.getOrderReasonCode(), 50, false, "OC-01-001-01-15-004", "订单原因编码");
        AssertUtils.lengthCheck(request.getReceiveWarehouseCode(), 50, false, "OC-01-001-01-15-004", "收货仓（逻辑仓库编码）");
        AssertUtils.lengthCheck(request.getContact(), 50, false, "OC-01-001-01-15-004", "联系人");
        AssertUtils.lengthCheck(request.getContactPhone(), 11, false, "OC-01-001-01-15-004", "联系电话");
//        AssertUtils.lengthCheck(request.getCloseReasonCode(), 50, false, "OC-01-001-01-15-004", "拒绝原因编码");
        Map<String, String> createTimeMap = AssertUtils.timeFormatCheck(request.getCreateBeginTime(), request.getCreateEndTime(), "创建开始日期", "创建结束日期", AssertUtils.TYPE_TIME);
        request.setCreateBeginTime(createTimeMap.get(AssertUtils.START_TIME));
        request.setCreateEndTime(createTimeMap.get(AssertUtils.END_TIME));
        AssertUtils.lengthCheck(request.getCustomerGrade(), 50, false, "OC-01-001-01-15-004", "客户等级");
        AssertUtils.lengthCheck(request.getCustomerGroup(), 50, false, "OC-01-001-01-15-004", "客户组");
        AssertUtils.lengthCheck(request.getFulfillmentTypeCode(), 50, false, "OC-01-001-01-15-004", "履约方式编码");
        AssertUtils.lengthCheck(request.getFulfillmentPriority(), 10, false, "OC-01-001-01-15-004", "履约优先级");
        AssertUtils.lengthCheck(request.getCustomerGrade(), 50, false, "OC-01-001-01-15-004", "客户等级");
        AssertUtils.lengthCheck(request.getCustomerGroup(), 50, false, "OC-01-001-01-15-004", "客户组");
        AssertUtils.lengthCheck(request.getOrderBizTag(), 50, false, "OC-01-001-01-15-004", "订单标签");
        AssertUtils.lengthCheck(request.getProductGroupCode(), 50, false, "OC-01-001-01-15-004", "产品组编码");
        AssertUtils.lengthCheck(request.getReqNo(), 50, false, "OC-01-001-01-15-004", "请求编号");
        AssertUtils.lengthCheck(request.getOrderBizTag(), 50, false, "OC-01-001-01-15-004", "订单标签");
        AssertUtils.lengthCheck(request.getBusinessChannel(), 50, false, "OC-01-001-01-15-004", "业务渠道编码");
        AssertUtils.lengthCheck(request.getDeliveryMethodCode(), 50, false, "OC-01-001-01-15-004", "配送方式编码");
        AssertUtils.lengthCheck(request.getNote(), 1024, false, "OC-01-001-01-15-004", "主单备注");
        if (CollectionUtils.isNotEmpty(request.getCloseReasonCodeList())) {
            AssertUtils.isTrue(request.getCloseReasonCodeList().size() > 10, "OC-01-001-01-15-004", "关闭原因编码集合", request.getCloseReasonCodeList().size(), 10);
            request.getCloseReasonCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "关闭原因编码");
                SalesOrderCloseEnum closeEnum = SalesOrderCloseEnum.of(x);
                Optional.ofNullable(closeEnum).orElseThrow(() -> new FunctionException("OC-01-001-01-15-006", "关闭原因编码"));
            });
        }
        if (CollectionUtils.isNotEmpty(request.getSaleChannelCodeList())) {
            AssertUtils.isTrue(request.getSaleChannelCodeList().size() > 10, "OC-01-001-01-15-004", "销售渠道编码集合", request.getSaleChannelCodeList().size(), 10);
            request.getSaleChannelCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "销售渠道编码");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getDeliveryMethodCodeList())) {
            AssertUtils.isTrue(request.getDeliveryMethodCodeList().size() > 10, "OC-01-001-01-15-004", "配送方式编码集合", request.getDeliveryMethodCodeList().size(), 10);
            request.getDeliveryMethodCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "配送方式编码");
            });
        }
        if (StringUtils.isNotEmpty(request.getDeliveryMethodCode())){
            SalesOrderDeliveryMethodEnum salesOrderDeliveryMethodEnum = SalesOrderDeliveryMethodEnum.of(request.getDeliveryMethodCode());
            Optional.ofNullable(salesOrderDeliveryMethodEnum).orElseThrow(() -> new FunctionException("OC-01-001-01-15-006", "配送方式编码"));
        }
        if (CollectionUtils.isNotEmpty(request.getReceiveWarehouseCodeList())) {
            AssertUtils.isTrue(request.getReceiveWarehouseCodeList().size() > 10, "OC-01-001-01-15-004", "收货仓（逻辑仓库编码）集合", request.getReceiveWarehouseCodeList().size(), 10);
            request.getReceiveWarehouseCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "收货仓（逻辑仓库编码）");
            });
        }
        if (CollectionUtils.isNotEmpty(request.getProductCodeList())) {
            AssertUtils.isTrue(request.getProductCodeList().size() > 10, "OC-01-001-01-15-004", "物料编码集合", request.getProductCodeList().size(), 10);
            request.getProductCodeList().forEach(x -> {
                AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "物料编码");
            });
        }
        Map<String, String> updateTimeMap = AssertUtils.timeFormatCheck(request.getModifyBeginTime(), request.getModifyEndTime(), "修改开始日期", "修改结束日期", AssertUtils.TYPE_TIME);
        request.setModifyBeginTime(updateTimeMap.get(AssertUtils.START_TIME));
        request.setModifyEndTime(updateTimeMap.get(AssertUtils.END_TIME));
        Map<String, String> vaildBeginTimeMap = AssertUtils.timeFormatCheck(request.getValidBeginDateStart(), request.getValidBeginDateEnd(), "生效开始日期", "生效结束日期", AssertUtils.TYPE_DATE);
        request.setValidBeginDateStart(vaildBeginTimeMap.get(AssertUtils.START_TIME));
        request.setValidBeginDateEnd(vaildBeginTimeMap.get(AssertUtils.END_TIME));
        Map<String, String> expectedDeliveryTimeMap = AssertUtils.timeFormatCheck(request.getExpectedDeliveryBeginDate(), request.getExpectedDeliveryEndDate(), "期望交货开始日期", "期望交货结束日期", AssertUtils.TYPE_DATE);
        request.setExpectedDeliveryBeginDate(expectedDeliveryTimeMap.get(AssertUtils.START_TIME));
        request.setExpectedDeliveryEndDate(expectedDeliveryTimeMap.get(AssertUtils.END_TIME));
        Map<String, String> sourceDateMap = AssertUtils.timeFormatCheck(request.getSourceOrderBeginTime(), request.getSourceOrderEndTime(), "来单开始时间", "来单结束时间", AssertUtils.TYPE_TIME);
        request.setSourceOrderBeginTime(sourceDateMap.get(AssertUtils.START_TIME));
        request.setSourceOrderEndTime(sourceDateMap.get(AssertUtils.END_TIME));
        //  枚举校验
        if (StringUtils.isNotBlank(request.getFulfillmentTypeCode())) {
            if(OrderCategoryEnum.GROUP.getCode().equals(orderCategory)) {
                List<DictionaryResponse> fulfillmentTypeList = forecastOrderAbility.baseDataServiceAdapter.queryDictionarys(DictionaryTypeEnum.GROUP_SALE_FULFILLMENT_TYPE.getCode());
                Map<String, DictionaryResponse> fulfillmentTypeMap = fulfillmentTypeList.stream().collect(Collectors.toMap(DictionaryResponse::getCode, Function.identity(), (k1, k2) -> k2));
                DictionaryResponse dictionaryResponse = fulfillmentTypeMap.get(request.getFulfillmentTypeCode());
                AssertUtils.isTrue(dictionaryResponse == null, "OC-01-001-01-15-006", "履约方式编码");
            } else if(OrderCategoryEnum.COMPANY.getCode().equals(orderCategory)){
                //履约方式
                List<DictionaryResponse> fulfillmentTypeList = forecastOrderAbility.baseDataServiceAdapter.queryDictionarys(DictionaryTypeEnum.COMPANY_SALE_FULFILLMENT_TYPE.getCode());
                Map<String, DictionaryResponse> fulfillmentTypeMap = fulfillmentTypeList.stream().collect(Collectors.toMap(DictionaryResponse::getCode, Function.identity(), (k1, k2) -> k2));
                DictionaryResponse dictionaryResponse = fulfillmentTypeMap.get(request.getFulfillmentTypeCode());
                AssertUtils.isTrue(dictionaryResponse == null, "OC-01-001-01-15-006", "履约方式编码");
            }
        }
        if (StringUtils.isNotBlank(request.getFulfillmentPriority())) {
            AssertUtils.isTrue(Objects.isNull(FulfillmentPriorityEnum.of(request.getFulfillmentPriority())), "OC-01-001-01-15-006", "履约优先级");
        }
        if (StringUtils.isNotBlank(request.getOrderBizTag())) {
            AssertUtils.isTrue(Objects.isNull(OrderBizTagEnum.of(request.getOrderBizTag())), "OC-01-001-01-15-006", "订单标签");
        }
        forecastOrderAbility.dictionaryVerifyAdapter.verifyDictionary(DictionaryTypeEnum.BUSINESS_TYPE.getCode(), request.getBusinessType(), new FunctionException("OC-01-001-01-15-006", "业态编码"));
        if(CollectionUtils.isNotEmpty(request.getFromSysList())) {
            request.getFromSysList().forEach(x -> {
                forecastOrderAbility.dictionaryVerifyAdapter.verifyDictionary(DictionaryTypeEnum.FROM_SYS.getCode(), x, new FunctionException("OC-01-001-01-15-006", "来源系统编码"));
            });
        }
        if(CollectionUtils.isNotEmpty(request.getBusinessUnitCodeList())) {
            request.getBusinessUnitCodeList().forEach(businessUnitCode -> {
                forecastOrderAbility.dictionaryVerifyAdapter.verifyDictionary(DictionaryTypeEnum.BUSINESS_UNIT_CODE.getCode(), businessUnitCode, new FunctionException("OC-01-001-01-15-006", "业务单元编码集合"));
            });
        }
        if (CollectionUtils.isNotEmpty(request.getOrderTypeCodeList())) {
            AssertUtils.isTrue(request.getOrderTypeCodeList().size() > 10, "OC-01-001-01-15-004", "订单类型编码集合", request.getOrderTypeCodeList().size(), 10);
            request.getOrderTypeCodeList().forEach(x -> AssertUtils.lengthCheck(x, 50, false, "OC-01-001-01-15-004", "订单类型编码"));
            if(OrderCategoryEnum.GROUP.getCode().equals(orderCategory)) {
                List<String> checkExistList = request.getOrderTypeCodeList().stream().filter(x ->
                        !Lists.newArrayList(ForecastOrderTypeEnum.GROUP_FORECAST.getCode()).contains(x)).collect(Collectors.toList());
                AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "订单类型编码集合");
            }else if(OrderCategoryEnum.COMPANY.getCode().equals(orderCategory)){
                List<String> checkExistList = request.getOrderTypeCodeList().stream().filter(x ->
                        Lists.newArrayList(ForecastOrderTypeEnum.GROUP_FORECAST.getCode()).contains(x)).collect(Collectors.toList());
                AssertUtils.isTrue(CollectionUtils.isNotEmpty(checkExistList), "OC-01-001-01-15-006", "订单类型编码集合");
            }
        }
    }
}
